<!--
 * @Author: zxm 308370383@qq.com
 * @Date: 2022-05-10 16:47:55
 * @LastEditors: zxm 308370383@qq.com
 * @LastEditTime: 2022-05-31 14:59:55
 * @FilePath: \0421\本地存储.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>localStrogae</p>
    <button onclick="change()">修改</button>
    <script>
        function change() {
            var time = new Date()
            localStorage.setItem('time', time)
        }
        window.addEventListener('storage', function (e) {
            console.log(123);
            console.log(e);
        })
    </script>
    <script>
        function change() {
            var time = new Date()
            localStorage.setItem('time', time)
        }
        window.addEventListener('storage', function (e) {
            console.log(123);
            console.log(e);
        })
    </script>
</body>

</html>
